<?php include $this->templateDir . 'common/header.php'; ?>
<style>
</style>
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card" style="margin-top: -10px;">
                <div class="layui-card-body" pad15="">
                    <div class="layui-form" wid100="" lay-filter="formTest">
                        <div class="layui-tab layui-tab-brief">
                            <ul class="layui-tab-title">
                                <li class="layui-this">网站配置</li>
                                <li>功能配置</li>
                            </ul>
                            <div class="layui-tab-content">
                                <div class="layui-tab-item layui-show">
                                   <!-- 网站配置内容页面-->
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">网站名称</label>
                                        <div class="layui-input-block" style="width:300px">
                                              <input type="text" name="webname" value="" lay-verify="required" class="layui-input">
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">网站域名</label>
                                        <div class="layui-input-block" style="width:300px">
                                            <input type="text" name="weburl" lay-verify="url" value="" class="layui-input">
                                        </div>
                                    </div>
                                    <div class="layui-form-item layui-form-text">
                                        <label class="layui-form-label">对外邮箱</label>
                                        <div class="layui-input-block" style="width:300px">
                                            <input type="text" name="adminemail"  value=""  lay-verify="email|required" class="layui-input">
                                        </div>
                                    </div>
                                    <div class="layui-form-item layui-form-text">
                                        <label class="layui-form-label">网站关键词</label>
                                        <div class="layui-input-block">
                                            <textarea name="keywords" lay-verify="required"  class="layui-textarea" placeholder="多个关键词用英文状态 , 号分割"></textarea>
                                        </div>
                                    </div>
                                    <div class="layui-form-item layui-form-text">
                                        <label class="layui-form-label">网站描述</label>
                                        <div class="layui-input-block">
                                            <textarea name="description" lay-verify="required"  class="layui-textarea"></textarea>
                                        </div>
                                    </div>
                                    <div class="layui-form-item layui-form-text">
                                        <label class="layui-form-label">版权信息</label>
                                        <div class="layui-input-block">
                                            <textarea name="copyright" class="layui-textarea"></textarea>
                                        </div>
                                    </div>
                                    <div class="layui-form-item layui-form-text">
                                        <label class="layui-form-label" id="icon-supervision">统计脚本<i class="iconfont icon-supervision" style="cursor: pointer" onclick="layer.tips('推荐使用https://web.51.la/ 只需要将统计代码里面的src的链接复制填写即可 比如：https://js.users.51.la/xxxxx.js','#icon-supervision')"></i></label>
                                        <div class="layui-input-block"> <textarea name="tongji" class="layui-textarea"></textarea> </div>
                                    </div>
                                 </div>
                                <div class="layui-tab-item">
                                   <!-- 功能配置-->
                                   <blockquote class="layui-elem-quote">前台功能配置</blockquote>
                                   <div class="layui-form-item">
                                       <label class="layui-form-label" style="margin-right: 10px;">前端整站模版</label>
                                       <div class="layui-input-inline" style="width: 300px;">
                                           <select name="tpl" id="tpl">
                                               <option value="-1">请选择</option>
                                               <option value="hyacinth">风信子</option>
                                               <option value="hibiscus">朱槿</option>
                                               <option value="shadan">傻蛋</option>
                                               <option value="choice">迷失的选择</option>
                                           </select>
                                       </div>
                                       <div id="icon-xuanzemoban" class="layui-form-mid layui-word-aux">
                                           <i class="iconfont icon-xuanzemoban" style="cursor: pointer" onclick="layer.tips('请选择一个合适的前端整站模版，此选择是应用于前端，给客户看的','#icon-xuanzemoban')"></i>
                                       </div>
                                   </div>
                                   <div class="layui-form-item">
                                       <label class="layui-form-label" style="margin-right: 10px;">是否开启注册</label>
                                       <div class="layui-input-inline" style="width: 300px;">
                                           <select name="registerswitch" id="registerswitch" lay-verify="">
                                               <option value="-1">是否开启注册？</option>
                                               <option value="1">开启</option>
                                               <option value="0">关闭</option>
                                           </select>
                                       </div>
                                       <div id="icon-zhucefuwu" class="layui-form-mid layui-word-aux">
                                           <i class="iconfont icon-zhucefuwu" style="cursor: pointer" onclick="layer.tips('请选择是否开启前台的注册功能？','#icon-zhucefuwu')"></i>
                                       </div>
                                   </div>
                                   <div class="layui-form-item">
                                       <label class="layui-form-label" style="margin-right: 10px;">找回密码</label>
                                       <div class="layui-input-inline" style="width: 300px;">
                                           <select name="forgetpwdswitch" id="forgetpwdswitch" lay-verify="">
                                               <option value="-1">是否开启？</option>
                                               <option value="1">开启</option>
                                               <option value="0">关闭</option>
                                           </select>
                                       </div>
                                       <div id="icon-zhaohuimima" class="layui-form-mid layui-word-aux">
                                           <i class="iconfont icon-zhaohuimima" style="cursor: pointer" onclick="layer.tips('是否开启前台的找回密码？','#icon-zhaohuimima')"></i>
                                       </div>
                                   </div>

                                   <div class="layui-form-item">
                                       <label class="layui-form-label" style="margin-right: 10px;">登录验证码</label>
                                       <div class="layui-input-inline"  style="width: 300px;">
                                           <select name="yzmswitch" id="yzmswitch" lay-verify="" >
                                               <option value="-1">是否开启？</option>
                                               <option value="1">开启</option>
                                               <option value="0">关闭</option>
                                           </select>
                                       </div>
                                       <div id="icon-yanzhengma" class="layui-form-mid layui-word-aux">
                                           <i class="iconfont icon-yanzhengma" style="cursor: pointer" onclick="layer.tips('是否开启前台的登录验证码？','#icon-yanzhengma')"></i>
                                       </div>
                                   </div>

                                   <div class="layui-form-item">
                                       <label class="layui-form-label" id="icon-beijing_tupian">前台背景图片地址 <i class="iconfont icon-beijing_tupian" style="cursor: pointer" onclick="layer.tips('输入前台背景网络图片地址，不输入则默认模板的背景','#icon-beijing_tupian')"></i></label>
                                       <div class="layui-input-block">
                                           <input type="text" name="backgroundimage" id="backgroundimage" placeholder="请输入前台背景图片地址" value="" class="layui-input">
                                       </div>
                                   </div>
                                   <div class="layui-form-item">
                                       <label class="layui-form-label">首页公告</label>
                                       <div class="layui-input-block">
                                           <textarea name="notic"  id="notic" class="layui-textarea">首页顶部的公告，例如：本系统商品均可正常购买。开源下载地址：github地址:https://github.com/zlkbdotnet/zfaka/</textarea>
                                       </div>
                                   </div>
                                   <div class="layui-form-item">
                                       <label class="layui-form-label">弹窗公告</label>
                                       <div class="layui-input-block">
                                           <textarea name="layerad" id="layerad" class="layui-textarea">第一次进入网站的弹窗公告提醒，可以是广告，也可以是消息</textarea>
                                       </div>
                                   </div>
                               </div>
                                <div class="layui-form-item">
                                    <div class="layui-input-block">
                                        <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="set_website">确认保存</button>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    layui.use(['element','form','layer'], function(){
        var element = layui.element
            , $ = layui.$
            ,layer = layui.layer
            ,form = layui.form;
        //初始化数据
        <?php echo $this->htmlData;?>
        //给表单赋值
        form.val("formTest", {
            "webname": dataobject.webname
            ,"weburl":  dataobject.weburl
            ,"keywords": dataobject.keywords
            ,"description": dataobject.description
            ,"adminemail": dataobject.adminemail
            ,"copyright": dataobject.copyright
            ,"tongji": dataobject.tongji
            ,"tpl":dataobject.tpl
            ,"forgetpwdswitch":dataobject.forgetpwdswitch
            ,"yzmswitch":dataobject.yzmswitch
            ,"registerswitch":dataobject.registerswitch
            ,"backgroundimage":dataobject.backgroundimage
            ,"notic":dataobject.notic
            ,"layerad":dataobject.layerad
        });
        //监听 - 网站配置
        form.on('submit(set_website)', function(data){
            $.ajax({
                url:"<?php echo u('deploy','index')?>"
                ,type:"post"
                ,dataType:"json"
                ,data:data.field
                ,success:function (res) {
                    if(res.status == "ok"){
                        layer.msg(res.data,{icon:1,time:2000},function () {
                            //为了避免数据不刷新，执行此操作全部更新渲染
                            form.render();
                        });
                    }else{
                      layer.msg(res.data,{icon:2});
                    }
                }
            });
            return false;
        });

    });
</script>
</body>
</html>